package io.renren.modules.app.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.pms.entity.PmsProductBrandEntity;
import io.renren.modules.pms.service.PmsProductBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 品牌表
 *
 * @author LuoShun
 * @email lori6166@163.com
 * @date 2021-12-23 15:15:38
 */
@Api(tags  = "app品牌接口")
@RestController
@RequestMapping("app/brand")
public class AppProductBrandController {
    @Autowired
    private PmsProductBrandService pmsProductBrandService;

    /**
     * 根据品牌名称分页获取品牌列表
     */
    @ApiOperation("根据品牌名称分页获取品牌列表")
    @GetMapping("/list")
    public R getList(@RequestParam Map<String, Object> params) {
        PageUtils page = pmsProductBrandService.queryPage(params);
        return R.ok().put("page",page);
    }

    /**
     * 根据id获取品牌
     */
    @ApiOperation("根据id获取品牌")
    @GetMapping("/{id}")
    public R info(@PathVariable("id") Long id){
		PmsProductBrandEntity brand = pmsProductBrandService.getById(id);
		return R.ok().put("data", brand);
    }
}
